#include <string>
#include <iostream>
#include <SimpleAmqpClient/SimpleAmqpClient.h>
using std::string;
struct MQinfo{
    string Exchange = "file_exchange";
    string Queue = "file_queue";
    string RoutingKey = "fileinfo";
};
int main(){
    MQinfo info;
    // 1 建立通信的连接channel
    AmqpClient::Channel::ptr_t channel = AmqpClient::Channel::Create();
    // 2 说明接下来的消费行为是阻塞的，从file_queue里面消费
    channel->BasicConsume(info.Queue);
    // 3 创建一个空信封
    AmqpClient::Envelope::ptr_t envelope;
    // 4 等待最多三秒
    bool flag = channel->BasicConsumeMessage(envelope,3000);
    if(flag){
        std::cout << "Body = " << envelope->Message()->Body() << "\n";
    }
    else{
        std::cerr << "timeout!\n";
    }
    return 0;
}